package  
{
	import as3isolib.geom.Pt;
	import com.smartfoxserver.v2.entities.Room;
	import flash.text.TextField;
	import flash.text.TextFormat;
	
	/**
	 * ...
	 * @author Bryan Keiren & Sander van Katwijk
	 */
	public class Globals
	{
		// Grid data.
		static public const Grid_Size:Number = 16;
		static public const Cell_Size:Number = 24;
		// Server login data.
		static public const Lobby_Room_Name:String = "The Lobby";
		static public const Zone_Name:String = "Zone1";
		static public var Current_Game_Room:Room = null;
		// Score data.
		static public const Score_Per_Flag:Number = 5;
		static public const Score_Send_Interval:int = 10;
		// Time data.
		static public var Delta_Time_MS:Number = 0;	// The time in milliseconds between the last two calls to updateTime().
		static public var Delta_Time_S:Number = 0;	// The time in seconds between the last two calls to updateTime().
		static public var Current_GMT:Date = new Date();
		static private var Previous_Time:Number = Current_GMT.getTime();
		// Global text format objects.
		static public const Text_Format_Arial15_Centered:TextFormat = new TextFormat("Arial", 15, null, null, null, null, null, null, "center");
		static public const Text_Format_Arial20_Centered:TextFormat = new TextFormat("Arial", 20, null, null, null, null, null, null, "center");
		static public const Text_Format_Arial25_Centered:TextFormat = new TextFormat("Arial", 25, null, null, null, null, null, null, "center");
		static public const Text_Format_Arial30_Centered:TextFormat = new TextFormat("Arial", 30, null, null, null, null, null, null, "center");
		static public const Text_Format_Arial15_AlignLeft:TextFormat = new TextFormat("Arial", 15, null, null, null, null, null, null, "left");
		static public const Text_Format_Arial20_AlignLeft:TextFormat = new TextFormat("Arial", 20, null, null, null, null, null, null, "left");
		static public const Text_Format_Arial25_AlignLeft:TextFormat = new TextFormat("Arial", 25, null, null, null, null, null, null, "left");
		static public const Text_Format_Arial30_AlignLeft:TextFormat = new TextFormat("Arial", 30, null, null, null, null, null, null, "left");
		static public const Text_Format_Consolas10_Centered:TextFormat = new TextFormat("Consolas", 10, null, null, null, null, null, null, "center");
		static public const Text_Format_Consolas15_Centered:TextFormat = new TextFormat("Consolas", 15, null, null, null, null, null, null, "center");
		static public const Text_Format_Consolas20_Centered:TextFormat = new TextFormat("Consolas", 20, null, null, null, null, null, null, "center");
		static public const Text_Format_Consolas25_Centered:TextFormat = new TextFormat("Consolas", 25, null, null, null, null, null, null, "center");
		static public const Text_Format_Consolas30_Centered:TextFormat = new TextFormat("Consolas", 30, null, null, null, null, null, null, "center");
		static public const Text_Format_Consolas15_AlignLeft:TextFormat = new TextFormat("Consolas", 15, null, null, null, null, null, null, "left");
		static public const Text_Format_Consolas20_AlignLeft:TextFormat = new TextFormat("Consolas", 20, null, null, null, null, null, null, "left");
		static public const Text_Format_Consolas25_AlignLeft:TextFormat = new TextFormat("Consolas", 25, null, null, null, null, null, null, "left");
		static public const Text_Format_Consolas30_AlignLeft:TextFormat = new TextFormat("Consolas", 30, null, null, null, null, null, null, "left");
		
		static public var Selected_Game_Name:String = "";
		static public var Selected_Game_Bool:Boolean = false;
		
		static public const UserName_InputField:TextField = new TextField();
		static public const Ingame_Score_TextField:TextField = new TextField();
		static public const EndOfGame_Textfield:TextField = new TextField();	
		static public const CurrentHighscore_Textfield:TextField = new TextField();
		
		static public const TeamColors:Array = new Array( 0xff00ff, 0xff0000, 0x0000ff, 0x00ff00, 0xffff00 );
		static public const TeamStartPositions:Array = new Array( new Pt(0, 0), 
																  new Pt(Grid_Size * Cell_Size, 0), 
																  new Pt(0, Grid_Size * Cell_Size), 
																  new Pt(Grid_Size * Cell_Size, Grid_Size * Cell_Size) );
		
		static public var initialFlagLocations:Array = new Array( new Pt(3, 3), new Pt(Globals.Grid_Size - 3, Globals.Grid_Size - 3),
																  new Pt(3, Globals.Grid_Size - 3), new Pt(Globals.Grid_Size - 3, 3),
																  new Pt(Globals.Grid_Size / 2, Globals.Grid_Size / 2) );
		// Team colors
		static public const DefaultTeamColor:uint = 0x00ffff;
		
		// Flag capture range.
		static public const Flag_Capture_Radius:Number = 50;
		static public const Flag_Capture_RadiusSq:Number = Flag_Capture_Radius * Flag_Capture_Radius;
		
		static public const Score_Limit:int = 3000;
		
		// Updates the time since the last call to this function. If this function is called each frame, DELTA_TIME represents
		// the time between the previous and the current frame.
		static public function updateTime():void
		{
			Current_GMT = new Date();	// Must be created anew each frame... >.>
			var currentTime:Number = Current_GMT.getTime();
			Delta_Time_MS = currentTime - Previous_Time;
			Delta_Time_S = Delta_Time_MS / 1000;
			Previous_Time = currentTime;
		}
	}

}